﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EGuayas.Web.Resources;
using EntGuayasSLA.BL;
using EntGuayasSLA.BL.Listas.Criterias;
using Ext.Net;

namespace EGuayas.Web.Auditoria.Admin.PMA
{
    public partial class pgAPma : pgBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
            if (!X.IsAjaxRequest)
            {
                var id = Request["cpm_id"];
                CloseTabs(TabPanel1, 1);
                Session[SessionPage.PageGestionAdminAudPmaEdit + Constantes.APMA] = id;
                Session[SessionPage.PageGestionAdminAudPmaEdit + "codFase_" + Constantes.APMA] = Constantes.APMA;
                var ExpedienteId = Request["exp_id"];
                Session[SessionPage.PageGestionAdminAudPmaEdit + Constantes.Expediente] = ExpedienteId;
                Session[SessionPage.PageGestionAdminAudPmaEdit + "FASE_ID_" + Constantes.APMA] = id;
                Session[SessionPage.PageGestionAdminAudPmaEdit + "_estadoFase" + Constantes.APMA] = Request["estadoFase"];
                var bNotAut = MostrarAlertaFaseNoAutorizada(SessionPage.PageGestionAdminAudPmaEdit, Constantes.APMA, false);
                if (bNotAut == true)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<div id='a0eebc99-9c0b-4ef8-bb6d-6bb9bd380008-body' class='x-panel-body x-panel-body-default x-panel-body-default x-docked-noborder-top x-docked-noborder-right x-docked-noborder-bottom x-docked-noborder-left' style='width: 1106px; height: 512px; left: 0px; top: 0px;'><center><br>");
                       

                    sb.Append("<div id='main-frame-error'>");
                    sb.Append("<div id='box'>");
                    sb.Append("<div class='read1'>");
                    sb.Append("<div class='read1-img1'>");
                    sb.Append(
                        "<img width='32' height='30' alt='img' src=''>");
                    sb.Append("</div>");
                    sb.Append("<center><h3>" + Titulos.TituloNoAutoriza + "</h3></center>");
                    sb.Append("<p>");
                    sb.Append(Mensajes.MensajeNoAccesoFase1 + " <b>" + Constantes.APMA + "</b> " +
                              Mensajes.MensajeNoAccesoFase2);
                    sb.Append("</p>");
                    sb.Append("</div>");
                    sb.Append("</div>");
                    sb.Append("</div>");

                    sb.Append("</center></div>");
                    Response.Write("<html><head>");
                    Response.Write("<link  href='../../../Resources/css/Style.css'  rel='stylesheet' /> ");
                    Response.Write("</head><body>");
                    Response.Write(sb);
                    Response.Write("</body></html>");
                    Response.End();
                }
            }
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }

        }
      
        /// <summary>
        /// Documentos correguir
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnCorrDocCatAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
            SetCustomConfigWucAllAud(panel, Constantes.APMA, Valores.Modulo_Archivo_Aud_Pma, SessionPage.PageGestionAdminAudPmaEdit, Request["cpm_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
    
        protected void OnTareasAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;

            SetCustomConfigWucAllAud(panel, Constantes.APMA, Valores.Modulo_Tarea_Aud_Pma, SessionPage.PageGestionAdminAudPmaEdit, Request["cpm_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
        protected void OnInformeAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
                Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
                SetCustomConfigWucAllAud(panel, Constantes.APMA, Valores.Modulo_Archivo_Informes_Aud_Pma, SessionPage.PageGestionAdminAudPmaEdit, Request["cpm_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }

    }


}